-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make StarDist2D macro-recordable #6
Conversation
it receives calls from IJ Macro and calls the actual plugin
and replaced it by a custom/manual solution
Hi @haesleinhuepf, thanks for the PR!
Is it possible to hide this new plugin completely?
Maybe @ctrueden can say something about that. To be honest, I'm not too happy with merging this code (not your fault), because it would duplicate the plugin parameters in several places in the code base. (I'd have to refactor this.) Best, |
Hi Robert, Wow, thanks for the effort! Indeed it would be really cool for stardist to be macro-record/callable. And ideally (similar to what Uwe said) that would be possible while staying within ImageJ2 and without constructing a IJ1 helper class around. E.g. the Elastix plugin by @Tischer is imo recordable, so there seems to be a way? (paging @frauzufall @Tischer @ctrueden ) cheers, |
I don't understand what is meant by "I assume the missing macro-recordability and -callability is a bug in ImageJ2s way of building dialogs." SciJava commands are macro recordable by default. |
Hi all, thanks for considering merging this. I assume many macro users would be really happy to be able to call StarDist.
@uschmidt83 I see your point. As mentioned above this might be a temporary thing until the upstream bug is fixed. I can also ship it as separate jar file if you like this solution more.
@ctrueden when using StarDist, the parameters are not recorded: If you add the parameters by hand, it still opens the dialog. Maybe also this user has the same problem:
@maweigert I tried quite some things with the ImageJ2-way and SciJava parameters and couldn't make it record/call correctly: I have the suspicion this bug is related to recent reports: https://forum.image.sc/t/scijava-command-macro-recording/35056 https://forum.image.sc/t/non-blocking-non-modal-ij2-plugin-dialog/8233/16 https://forum.image.sc/t/imagej2-command-macro/29650 Let me know if I can help resolving this. Cheers, |
Funny enough, the macro seems to be recorded just fine when lauching the current StarDist plugin (without Robert's new code) from within Eclipse. I can also execute it after recording, but I still have to click the OK button. Maybe this gives a hint as to where the problem is. |
Yes, weird behaviour. Additionally(via @uschmidt83) when using the StarDist as a standalone plugin (e.g. from IntelliJ) recording does work correctly. Strange indeed. |
@maweigert @uschmidt83 Oh weird. In my IntelliJ it doesn't... Which main() method did you call? I tried this one but I had to change the filename... |
Oha.
Yep, this one |
I also added
|
This (in public static void main(final String... args) throws Exception {
final ImageJ ij = new ImageJ();
ij.launch(args);
Dataset input = ij.scifio().datasetIO().open(StarDist2D.class.getClassLoader().getResource("test_img.tif").getFile());
ij.ui().show(input);
Recorder recorder = new Recorder();
recorder.show();
final HashMap<String, Object> params = new HashMap<>();
ij.command().run(StarDist2D.class, true, params);
} |
Yes, that's what I also saw. If you disable all these components (model file and url, informational messages, both buttons), it runs through without the need to click OK. At least that's what I observe when recording and running the macro (StarDist started from Eclipse). |
thanks for walking along down the rabbit hole @haesleinhuepf (pun intended :)!
Ok! Strange still, as it did work for me (OSX) with scijava 27.0.1 (which is the version in stardists pom.xml).
Apparently, adding button parameters (even with There must be a way around this... |
Yes, that's what was reported on the forum as well: |
Thanks! Yep, that seems to be the identical problem, this recent PR by @frauzufall being related, too. |
Actually, it seems to have nothing to do with scijava, but with stardist itself. Deploying the plugin from commit 549a6d0 onwards (the PR by @lacan) will record the parameter string (thus a new StarDist release would fix it)! And I have no idea why :) |
ImageJ Magic (MagikJ) |
I'm closing this since similar functionality has now been merged with PR #7. |
Hi @uschmidt83,
there you go. As discussed here and here, this brings some custom macro-recording and another plugin (a bit hidden in the menu) which serves as mediator. It calls the actual StarDist2D plugin.
The macro recorder now records things like this, which are also executable:
I assume the missing macro-recordability and -callability is a bug in ImageJ2s way of building dialogs. As soon as this bug is fixed, we can revert this commit here.
If there are any issues with this plugin, feel free to tag/ping me. I'm happy to support/maintain this part.
Cheers,
Robert